/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Carito
 */
@Entity
@Table(name = "INDDEUDA")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Inddeuda.findAll", query = "SELECT i FROM Inddeuda i"),
    @NamedQuery(name = "Inddeuda.findByIdinddeuda", query = "SELECT i FROM Inddeuda i WHERE i.inddeudaPK.idinddeuda = :idinddeuda"),
    @NamedQuery(name = "Inddeuda.findByFecha", query = "SELECT i FROM Inddeuda i WHERE i.fecha = :fecha"),
    @NamedQuery(name = "Inddeuda.findByTipotitulo", query = "SELECT i FROM Inddeuda i WHERE i.tipotitulo = :tipotitulo"),
    @NamedQuery(name = "Inddeuda.findByUltimatasa", query = "SELECT i FROM Inddeuda i WHERE i.ultimatasa = :ultimatasa"),
    @NamedQuery(name = "Inddeuda.findByTasapromedio", query = "SELECT i FROM Inddeuda i WHERE i.tasapromedio = :tasapromedio"),
    @NamedQuery(name = "Inddeuda.findByIddato", query = "SELECT i FROM Inddeuda i WHERE i.inddeudaPK.iddato = :iddato")})
public class Inddeuda implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected InddeudaPK inddeudaPK;
    @Column(name = "FECHA")
    @Temporal(TemporalType.DATE)
    private Date fecha;
    @Size(max = 180)
    @Column(name = "TIPOTITULO")
    private String tipotitulo;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "ULTIMATASA")
    private BigDecimal ultimatasa;
    @Column(name = "TASAPROMEDIO")
    private BigDecimal tasapromedio;
    @JoinColumn(name = "IDDATO", referencedColumnName = "IDDATO", insertable = false, updatable = false)
    @ManyToOne(optional = false, fetch = FetchType.EAGER)
    private Dato dato;

    public Inddeuda() {
    }

    public Inddeuda(InddeudaPK inddeudaPK) {
        this.inddeudaPK = inddeudaPK;
    }

    public Inddeuda(BigInteger idinddeuda, BigInteger iddato) {
        this.inddeudaPK = new InddeudaPK(idinddeuda, iddato);
    }

    @XmlElement
    public InddeudaPK getInddeudaPK() {
        return inddeudaPK;
    }

    public void setInddeudaPK(InddeudaPK inddeudaPK) {
        this.inddeudaPK = inddeudaPK;
    }

    @XmlElement
    public Date getFecha() {
        return fecha;
    }

    public void setFecha(Date fecha) {
        this.fecha = fecha;
    }

    @XmlElement
    public String getTipotitulo() {
        return tipotitulo;
    }

    public void setTipotitulo(String tipotitulo) {
        this.tipotitulo = tipotitulo;
    }

    @XmlElement
    public BigDecimal getUltimatasa() {
        return ultimatasa;
    }

    public void setUltimatasa(BigDecimal ultimatasa) {
        this.ultimatasa = ultimatasa;
    }

    @XmlElement
    public BigDecimal getTasapromedio() {
        return tasapromedio;
    }

    public void setTasapromedio(BigDecimal tasapromedio) {
        this.tasapromedio = tasapromedio;
    }

    public Dato getDato() {
        return dato;
    }

    public void setDato(Dato dato) {
        this.dato = dato;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (inddeudaPK != null ? inddeudaPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Inddeuda)) {
            return false;
        }
        Inddeuda other = (Inddeuda) object;
        if ((this.inddeudaPK == null && other.inddeudaPK != null) || (this.inddeudaPK != null && !this.inddeudaPK.equals(other.inddeudaPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Inddeuda[ inddeudaPK=" + inddeudaPK + " ]";
    }
    
}
